package cmd

import (
	"fmt"
	"im-tools/internal/service"

	"github.com/gookit/color"
	"github.com/spf13/cobra"
)

var batchFriendsCmd = &cobra.Command{
	Use:   "addFriends",
	Short: "批量添加好友",
	Long:  `批量加好友`,
	Run: func(cmd *cobra.Command, args []string) {
		var count int

		for {
			color.Info.Println("输入数量:")
			if _, err := fmt.Scanln(&count); err != nil {
				continue
			}

			if count > 0 && LoginedUserId != "" {
				break
			}

			fs := service.FriendService{}
			fs.AddFriends(LoginedUserId, count)
			color.Info.Println("批量添加好友成功")
		}
	},
}

func init() {
	rootCmd.AddCommand(batchFriendsCmd)
}
